﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using System.Reflection;
using BitAuto.EP.CRMLogSystem.Utils;

namespace BitAuto.EP.CRMLogSystem.Entity
{
    public class ProduceDataForMQ
    {

         #region Properties
         /// <summary>
         /// 日志表ID
         /// </summary>
         public int LogTableId
         {
             set;
             get;
         }
         /// <summary>
         /// 日志表ID
         /// </summary>
         public string LogContent
         {
             set;
             get;
         }
         public int ObjectID
         {
             get;
             set;
         }
	    #endregion


        public ProduceDataForMQ()
        {
            this.LogTableId = 0;
            this.LogContent = string.Empty;
        }



        /// <summary>
        /// 将实体转换为字节数组
        /// </summary>
        public byte[] ConvertToByteArray()
        {
            return Encoding.UTF8.GetBytes(JsonHelper.JsonSerializeForJava(this));
        }
        /// <summary>
        /// 将字节数组转换为实体
        /// </summary>
        public void ConvertToModule(string msg)
        {
            if (msg == null || msg.Length < 1) return;
            var res = JsonHelper.JsonDeserializeForJava<ProduceDataForMQ>(msg);

            this.LogTableId = res.LogTableId;
            this.LogContent = res.LogContent;
        }

    }
}
